package com.xteam.youin_supplier.fragment;


import android.support.v4.app.Fragment;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;
import android.widget.Toast;


import com.xteam.youin_supplier.MainActivity;
import com.xteam.youin_supplier.R;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.ViewById;



/**
 * 个人中心
 */
@EFragment(R.layout.fragment_setting)
public class SettingFragment extends BaseFragment {
    @ViewById(R.id.back_btn)
    ImageButton backBtn;

    @ViewById(R.id.toptitle_title)
    TextView topTitle;

    @AfterViews
    @Override
    void initView() {
        backBtn.setVisibility(View.GONE);
        topTitle.setText(getResources().getString(R.string.center_title));
    }

    @Click({R.id.baseinfo_layout, R.id.private_setting_layout, R.id.sales_layout, R.id.market_layout,
            R.id.clean_cache_layout, R.id.update_version_layout})
    @Override
    void Click(View view) {
        Fragment fragment = null;
        switch (view.getId()) {
            case R.id.baseinfo_layout:
                fragment = new BaseInfoFragment_();
                break;
            case R.id.private_setting_layout:
                fragment = new PrivateInfoFragment_();
                break;
            case R.id.sales_layout:
                fragment = new SalesFragment_();
                break;
            case R.id.market_layout:
                fragment = new MessageListFragment_();
                break;
            case R.id.clean_cache_layout:
                fragment = new CleanCacheFragment_();
                break;
            case R.id.update_version_layout:
                fragment = new VersionUpdateFragment_();
                break;
        }
        if (fragment != null){
            MainActivity.getInstance().switchFragment(this, fragment);
        }
    }

}
